//
//  CollectionCell.m
//  Leo01
//
//  Created by 张旭 on 15/9/2.
//  Copyright (c) 2015年 张旭. All rights reserved.
//

#import "CollectionCell.h"

@implementation CollectionCell

@synthesize labelLeadingCon;
@synthesize labelTrailingCon;
@synthesize imageLeadingCon;
@synthesize imageTrailingCon;

- (void)awakeFromNib {
    // Initialization code
}

-(CollectionCell *)changeToNewCell{
    
    imageLeadingCon.constant=7.5;
    imageTrailingCon.constant=7.5;
    [self setFrame:CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width+5, self.frame.size.height)];
    return self;
}
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        // 初始化时加载collectionCell.xib文件
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"CollectionCell" owner:self options:nil];
        
        // 如果路径不存在，return nil
        if (arrayOfViews.count < 1)
        {
            return nil;
        }
        // 如果xib中view不属于UICollectionViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])
        {
            return nil;
        }
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
        self.label.textAlignment = UITextAlignmentCenter;
        self.label.adjustsFontSizeToFitWidth = YES;
        
        
        

    }
    return self;
}
@end
